package org.elanfox.intellicommunity.intellicommunityadmin.base.security;

import org.elanfox.intellicommunity.intellicommunityadmin.config.SecurityConfig;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author gmw
 * @date 2018-11-13
 */
public class SmAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuccessHandler {
    @Override
    public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
        this.setDefaultTargetUrl(SecurityConfig.LOGIN_SUCCESS_URL);
        super.onAuthenticationSuccess(request, response, authentication);


    }
}
